package coderead.plugin.common;
/**
 * @Copyright 源码阅读网 http://coderead.cn
 */

import com.intellij.ui.awt.RelativePoint;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;

/**
 * @author 鲁班大叔
 * @date 2021
 */
public class UICommon {
    public static void showAt( RelativePoint point,  JPopupMenu menu) {
        menu.show(point.getComponent(), point.getPoint().x, point.getPoint().y);
        menu.getSelectionModel().setSelectedIndex(1);
        menu.grabFocus();;
    }
    public static void showByEvent( MouseEvent event,  JPopupMenu menu) {
        menu.show(event.getComponent(), event.getX(), event.getY());
        menu.getSelectionModel().setSelectedIndex(1);
        menu.grabFocus();;
    }
}
